public class Demo6 {
    public static void main(String[] args) {
        //冒泡法排序
        int[] arr = {180, 438, 435, 22, 38};
        int temp;
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j] > arr[j + 1]) {//j438>j+1 435
                    temp = arr[j];//t=438
                    arr[j] = arr[j + 1];
                    ;//j=435
                    arr[j + 1] = temp;//j+1=t=438
                }//小在前，大在后，升序
            }
        }
        for (int a : arr) {
            System.out.println(a + ",");
        }
    }
}
